import requests
url = "https://movie.douban.com/top250"
headers = {
    'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36'
}
params = {
    'start':0
}
index = 1
for i in range(0,250,25):
    params['start'] = i
    resp = requests.get(url,headers=headers,params=params)
    if resp.status_code==200:
        with open(f'top250/src{index}.html','w',encoding='utf-8',newline='') as f:
            f.write(resp.text)
        index+=1

